/**
 * 给定N和M，要求求出所有的序列满足：
 * 1. 长度为N
 * 2. 后一项比前一项至少大10
 * N和M显然不大，直接递归即可
 * 注意要剪枝，否则会T
 */
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;

using llt = long long;
using vi = vector<int>;
using vll = vector<llt>;
using pii = pair<int, int>;
using pll = pair<llt, llt>;

int N, M;
vi A;
vector<vi> Ans;

void dfs(){
    if(A.size() == N){
        Ans.push_back(A);
        return;
    }

    int left = N - A.size();
    for(int i=A.back()+10;i<=M-(left-1)*10;++i){
        A.push_back(i);
        dfs();
        A.pop_back();
    }
    return;
}

void work(){
    cin >> N >> M;
    for(int i=1;i<=M-(N-1)*10;++i){
        A.push_back(i);
        dfs();
        A.pop_back();
    }

    cout << Ans.size() << "\n";
    for(const auto & v : Ans){
        for(auto i : v) cout << i << " ";
        cout << "\n";
    }
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);	
    int nofkase = 1;
	// cin >> nofkase;
	while(nofkase--) work();
	return 0;
}